  {extend name="Public:user_base" /}
  {block name="body"}

<div class="ucenter-right">


<div class="my-contribution fixed-box" style="padding-top: 0px;" >
<div class="console-box">

<a href="{:url('user/userfocus',array('type'=>1))}"  {if condition="$type eq 1"}class="current"{/if}>好友</a>
<a href="{:url('user/userfocus',array('type'=>2))}"  {if condition="$type eq 2"}class="current"{/if}>关注</a>
<a href="{:url('user/userfocus',array('type'=>3))}"  {if condition="$type eq 3"}class="current"{/if}>粉丝</a>
</div>

{if condition="$type eq 1"}

{if condition="count($userlist) gt 0"}
<div class="boxcontent">

       <div class="clearfix">
         <ul class="userfocus">
         
          {volist name="userlist" id="vo"}
    <li>
     <span class="col-md-7" style="padding-left:0px;">
             <a href="{:url('user/home',array('id'=>$vo.userid))}">
              <img src="{:getheadurl($vo['userhead'])}"">
              </a>    
              <div>
              <dt><a href="{:url('user/home',array('id'=>$vo.userid))}">{$vo.nickname}</a>    </dt>
              <dd>个人文档数{$vo.doccount}</dd>
              </div>
                 </span>
                    <span  class="col-md-4 text-right">
           {if condition="hasfocus($vo.userid,$uid) eq 1"}
           
            <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn gzclass"    data-id="{$vo.userid}" data-type="1">
						<i class="iconfont icon-iconfont707"></i> <span> 关注</span></a>  
           
           {elseif condition="hasfocus($vo.userid,$uid) eq 2"} 
           		 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn"  data-id="{$vo.userid}" data-type="2">
						<i class=" iconfont icon-duigou"></i> <span> 已关注</span></a>  
            {elseif condition="hasfocus($vo.userid,$uid) eq 3"} 
                 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn "  data-id="{$vo.userid}" data-type="3">
						<i class="iconfont icon-zhuanjialiebiaohaoyouguanxianniu"></i> <span> 好友关系</span></a>  
           {else/}
           无任何关系
           {/if}
						 
					
                    </span>
    
    </li>
   {/volist}
       </ul>

                   </div>
                    <div class="pages">
						<ul class="pagination">
						{$userlist->render()}
						</ul>
					</div>
</div>

{else/}

<div class="empty-tip-box">
<div class="inner-box">

<div class="info">
<p class="iconfont icon-wujilu"></p>
<p class="first">还未找到任何数据</p>
<p class="second">在个人页面，点击"关注图标"，时刻了解他的动态~</p>
</div>
</div>
</div>
{/if}


{elseif condition="$type eq 2"}
{if condition="count($userlist) gt 0"}
<div class="boxcontent">

       <div class="clearfix">
         <ul class="userfocus">
         
          {volist name="userlist" id="vo"}
    <li>
     <span class="col-md-7" style="padding-left:0px;">
             <a href="{:url('user/home',array('id'=>$vo.userid))}">
              <img src="{:getheadurl($vo['userhead'])}"">
              </a>    
              <div>
              <dt><a href="{:url('user/home',array('id'=>$vo.userid))}">{$vo.nickname}</a>    </dt>
              <dd>个人文档数{$vo.doccount}</dd>
              </div>
                 </span>
                    <span  class="col-md-4 text-right">
     
           {if condition="hasfocus($vo.userid,$uid) eq 1"}
           
            <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn gzclass"    data-id="{$vo.userid}" data-type="1">
						<i class="iconfont icon-iconfont707"></i> <span> 关注</span></a>  
           
           {elseif condition="hasfocus($vo.userid,$uid) eq 2"} 
           		 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn"  data-id="{$vo.userid}" data-type="2">
						<i class=" iconfont icon-duigou"></i> <span> 已关注</span></a>  
            {elseif condition="hasfocus($vo.userid,$uid) eq 3"} 
                 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn "  data-id="{$vo.userid}" data-type="3">
						<i class="iconfont icon-zhuanjialiebiaohaoyouguanxianniu"></i> <span> 好友关系</span></a>  
           {else/}
           无任何关系
           {/if}
					
                    </span>
    
    </li>
   {/volist}
       </ul>

                   </div>
                    <div class="pages">
						<ul class="pagination">
						{$userlist->render()}
						</ul>
					</div>
</div>

{else/}

<div class="empty-tip-box">
<div class="inner-box">

<div class="info">
<p class="iconfont icon-wujilu"></p>
<p class="first">还未找到任何数据</p>
<p class="second">在个人页面，点击"关注图标"，时刻了解他的动态~</p>
</div>
</div>
</div>
{/if}
{else/}
{if condition="count($userlist) gt 0"}
<div class="boxcontent">

       <div class="clearfix">
         <ul class="userfocus">
         
          {volist name="userlist" id="vo"}
    <li>
     <span class="col-md-7" style="padding-left:0px;">
             <a href="{:url('user/home',array('id'=>$vo.userid))}">
              <img src="{:getheadurl($vo['userhead'])}"">
              </a>    
              <div>
              <dt><a href="{:url('user/home',array('id'=>$vo.userid))}">{$vo.nickname}</a>    </dt>
              <dd>个人文档数{$vo.doccount}</dd>
              </div>
                 </span>
                    <span  class="col-md-4 text-right">
           {if condition="hasfocus($vo.userid,$uid) eq 1"}
           
            <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn gzclass"    data-id="{$vo.userid}" data-type="1">
						<i class="iconfont icon-iconfont707"></i> <span> 关注</span></a>  
           
           {elseif condition="hasfocus($vo.userid,$uid) eq 2"} 
           		 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn"  data-id="{$vo.userid}" data-type="2">
						<i class=" iconfont icon-duigou"></i> <span> 已关注</span></a>  
            {elseif condition="hasfocus($vo.userid,$uid) eq 3"} 
                 <a href="javascript:void(0);" class="h-icon-base h-attention-btn focusbtn "  data-id="{$vo.userid}" data-type="3">
						<i class="iconfont icon-zhuanjialiebiaohaoyouguanxianniu"></i> <span> 好友关系</span></a>  
           {else/}
           无任何关系
           {/if}
						 
						
                    </span>
    
    </li>
   {/volist}
       </ul>

                   </div>
                    <div class="pages">
						<ul class="pagination">
						{$userlist->render()}
						</ul>
					</div>
</div>

{else/}

<div class="empty-tip-box">
<div class="inner-box">

<div class="info">
<p class="iconfont icon-wujilu"></p>
<p class="first">还未找到任何数据</p>
<p class="second">在个人页面，点击"关注图标"，时刻了解他的动态~</p>
</div>
</div>
</div>
{/if}
{/if}




</div>
</div>
    {/block}
    {block name="script"}
    <script>
    $(function(){
    	$('.focusbtn').click(function(){
   		 
  		  
   		 if(!$(this).hasClass('gzclass')){
   			 
   			    $.post("{:url('user/focususer')}",{useruid:$(this).data('id'),type:2},function(data){
   			    	
   				      if(data.code == 1){
   				        
   				        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
   				        	
   				         $('.focusbtn').addClass('gzclass');
   				         $('.focusbtn').html('<i class="iconfont icon-iconfont707"></i> <span> 关注</span>');
   				        	
   				        });
   				      }else{
   				        
   				        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
   				        
   				        
   				        
   				      }
   				    });
   			 
   			 
   			 
   		 }else{
   			 
   			    $.post("{:url('user/focususer')}",{useruid:$(this).data('id'),type:1},function(data){
   			    	
   				      if(data.code == 1){
   				     
   				        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
   				        	
   				        	$('.focusbtn').removeClass('gzclass');
   				     	var type=$('.focusbtn').data('type');
   			       	 if(type==1){
   						 
   					 }else if(type==2){
   						 $('.focusbtn').html('<i class=" iconfont icon-duigou"></i> <span> 已关注</span>'); 
   					 }else{
   						 $('.focusbtn').html('<i class="iconfont icon-zhuanjialiebiaohaoyouguanxianniu"></i> <span> 好友关系</span></a>'); 
   					 }
      				       
   				        	
   				        });
   				      }else{
   				       
   				        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
   				        
   				        
   				        
   				      }
   				    });
   			
   			
   		 }
   		 
   		
   	 });
    	
    	
        $('.focusbtn').hover(function(){
        	
        	 if(!$(this).hasClass('gzclass')){
        		 $(this).addClass('gzhover');
        		 var type=$(this).data('type');
        		 $(this).html('<i class=" iconfont icon-jianhao1"></i> <span> 取消关注</span>'); 
        		
        		 
        		 
        	 }
       		 
       		
       	 },function(){
       		if(!$(this).hasClass('gzclass')){
       		 $(this).removeClass('gzhover');
       		var type=$(this).data('type');
       	 if(type==1){
			 
		 }else if(type==2){
			 $(this).html('<i class=" iconfont icon-duigou"></i> <span> 已关注</span>'); 
		 }else{
			 $(this).html('<i class="iconfont icon-zhuanjialiebiaohaoyouguanxianniu"></i> <span> 好友关系</span></a>'); 
		 }
       		
       		 
       	 }
       		 
       	 });
    });

	

</script>
{/block}